<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<select id="sel"></select>
<script>
test(function() {
  var div = document.createElement('div');
  var div2 = document.createElement('div');
  var optgroup = document.createElement('optgroup');
  var sel = document.getElementById('sel');
  sel.appendChild(div2);

  var opt = document.createElement('option');
  sel.add(opt);
  sel.add(optgroup);
  assert_throws_dom("NotFoundError", function() { sel.add(opt, div); });
  assert_throws_dom("NotFoundError", function() { sel.add(optgroup, div); });
  sel.add(opt, div2);
  sel.add(optgroup, div2);
  sel.add(opt, 5);
  sel.add(optgroup, 5);
  assert_throws_js(TypeError, function() { sel.add(div) });
  sel.add(optgroup, function() {})
});
</script>
</head>
</html>
